<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        class Person {
            // 属性
            #n;
            age;

            // getter setter
            get name() {
                console.log("getter")
                return this.n;
            }
            set name(n) {
                console.log("setter")
                this.n = n;
            }

            // 实例方法
            eat(food) {
                console.log(`${this.age}岁的${this.n}正在吃${food}`)
            }
            
            // 静态方法
            static sum(a,b) {
                return a + b
            }

            // 构造器
            constructor(name, age) {
                this.n = name
                this.age = age
            }
        }

        class Student extends Person {
            score
            study() {
                console.log(`${this.age}岁的${this.name}正在努力学习，考试成绩为${this.score}分`)
            }
            constructor(name,age,score) {
                super(name,age)
                this.score = score
            }
        }
        let stu = new Student('zzz',8,100)
        stu.study()
    </script>
</head>
<body>
    
</body>
</html>